//
//  ZYLTools.m
//  XXWeiBo
//
//  Created by mac on 15-1-31.
//  Copyright (c) 2015年 mac. All rights reserved.
//

#import "ZYLTools.h"

@implementation ZYLTools

+ (UIBarButtonItem *)itemWithImage:(NSString *)image higImage:(NSString *)higImage target:(id)target action:(SEL)action
{
    UIButton *btn = [[UIButton alloc] init];
    // 设置对应状态图片
    [btn setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:higImage] forState:UIControlStateHighlighted];
    // 设置frame
    btn.size = btn.currentImage.size;
    // 添加监听事件
    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    return [[UIBarButtonItem alloc] initWithCustomView:btn];
}

@end
